﻿using System.Reflection;

using boda.net.wpf.core.Extensions;
using boda.net.wpf.core.Ioc;
using boda.net.wpf.menu.Views;
using boda.net.wpf.share.Prism;

using Prism.Ioc;
using Prism.Modularity;
using Prism.Regions;

namespace boda.net.wpf.menu
{
    /// <summary>
    /// 定义了模块的名字，按需加载
    /// </summary>
    [Module(ModuleName = ModuleNames.ApplicationMenuModule, OnDemand = true)]
    public class ApplicationMenuModule : IModule
    {
        public void OnInitialized(IContainerProvider containerProvider)
        {
            containerProvider.InitialAssembly(Assembly.GetExecutingAssembly());
            // 注册带导航
            //containerProvider.Resolve<IRegionManager>().RegisterViewWithRegion<MenuView>(RegionNames.MenuRegion);
            // 全局静态变量注入
            PrismProvider.RegionManager.RegisterViewWithRegion<MenuView>(RegionNames.MenuRegion);
        }

        public void RegisterTypes(IContainerRegistry containerRegistry)
        {
            containerRegistry.RegisterAssembly(Assembly.GetExecutingAssembly());

            // 注册
            // containerRegistry.RegisterForNavigation<MenuView>();
        }
    }
}
